/*
 * Copyright 2012 Niklas Rehfeld
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.madpie;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.Map;
import javax.xml.bind.JAXBException;
import org.madpie.converters.Lscpu;
import org.madpie.converters.Lspci;
import org.madpie.util.CLIUtils;
import org.madpie.util.SchemaUtils;
import org.xml.sax.SAXException;

/**
 *
 * @author Niklas Rehfeld
 */
public class Madpie {

    /**
     * @param args the command line arguments
     * 
     * TODO fix all this mess up. At the moment it's a horrible mess.
     */
    public static void main(String[] args) throws FileNotFoundException, JAXBException, JAXBException, IOException, SAXException {
        Map<String, String> argMap = CLIUtils.createArgumentMap(args);
//        Arrays.sort(args);// bad idea. 
        if (argMap.containsKey("-p")) {
            System.exit(runLspci(args));
        } else if (argMap.containsKey("-c")) {
            System.exit(runlscpu(args));
        }
    }

    static int runLspci(String[] args) throws FileNotFoundException, JAXBException, JAXBException, IOException {
        Lspci.main(args);
        return 0;

    }

    static int runlscpu(String[] args) throws FileNotFoundException, FileNotFoundException, JAXBException, JAXBException, IOException, SAXException {
        Lscpu.main(args);
        return 0;
    }
}
